package com.qzxy.premiumhotelsystem.mapper;

import com.qzxy.premiumhotelsystem.domain.entity.Employees;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qzxy.premiumhotelsystem.domain.entity.Guests;
import com.qzxy.premiumhotelsystem.domain.entity.Logs;
import com.qzxy.premiumhotelsystem.domain.vo.EmployeeInfoVo;
import com.qzxy.premiumhotelsystem.domain.vo.GuestInfoVo;
import com.qzxy.premiumhotelsystem.domain.vo.LoginVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
* @author 14912
* @description 针对表【employees】的数据库操作Mapper
* @createDate 2024-09-12 15:55:14
* @Entity com.qzxy.premiumhotelsystem.domain.pojo.Employees
*/
@Mapper
public interface EmployeesMapper extends BaseMapper<Employees> {
    /**
     * 员工登录方法
     * @param loginVo
     * @return
     */
    @Select("select password from employees where telephone = #{telephone}")
    String login(LoginVo loginVo);

    /**
     * 根据手机号删除员工
     * @param telephone
     * @return
     */
    @Delete("delete from employees where telephone = #{telephone}")
    boolean deleteByTelephoneBoolean(String telephone);

    /**
     * 通过电话查找员工
     * @param telephone
     * @return
     */
    @Select("select * from employees where telephone = #{telephone}")
    Employees getByTelephone(String telephone);

    /**
     * 通过邮箱查找员工
     * @param email
     * @return
     */
    @Select("select * from employees where email = #{email}")
    Employees getByEmail(String email);
    /**
     * 查询所有员工
     * @return
     */
    @Select("select * from employees")
    List<Employees> allEmployees();

    /**
     * 更新登录状态
     * @param loginIp
     * @param loginTime
     * @return
     */
    @Update("update employees set login_ip = #{loginIp},login_time = #{loginTime} where telephone = #{telephone}")
    boolean updateLoginStatus(String loginIp,String loginTime,String telephone);

    /**
     * 修改顾客基本信息
     * @param employeeInfoVo
     * @return
     */
    @Update("update employees set " +
            "nickname = #{nickname}, " +
            "id_card = #{idCard}, " +
            "age = #{age}, " +
//            "img_Url = #{imgUrl}," +
            "sex = #{sex}, " +
            "salary = #{salary} " +
            "where telephone = #{telephone}")
    boolean updateInformation(EmployeeInfoVo employeeInfoVo);

    /**
     * 头像上传
     * @param url
     * @param telephone
     * @return
     */
    @Update("update employees set img_Url = #{url} where telephone = #{telephone}")
    boolean uploadAvatar(String url,String telephone);

    /**
     * 更新员工状态
     * @param telephone
     * @param status
     * @return
     */
    @Update("update employees set " +
            "status = #{status}" +
            "where telephone = #{telephone}")
    boolean updateStatue(String telephone,String status);
}




